<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><{:C('web_site_name')}>---更新全站缓存</title>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/common.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/main.css"/>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/lib.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/layer.min.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/fileuploader.js"></script>
</head>
<body>


<form  id="info_form" >
<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>首页<span class="crumb-step">&gt;</span><span class="crumb-name">更新全站缓存</span></div>
        </div>
        
        <div class="result-wrap">
            <div class="result-content">
            <form id="info_form">
                    <table class="insert-tab">
                        <tbody>
                            <tr>
                                <th>全选/反选</th>
                                <td>
									<input type="checkbox" value="" id="all">           
                                </td>
                            </tr>
                            <?php 
                            	foreach($cacheDir as $c => $v ){
                            ?>
                             <tr style="color:red">
                                <th ><?php echo $v['name'];?>：</th>
                                <td>
                                <input value="<?php echo $c;?>"  name="cache[]" type="checkbox"  class="common-text required" />
           
                                </td>
                            </tr>
                            <?php } ?>
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" id="btn" value="提交" type="button">
                                </td>
                            </tr>
                        </tbody></table></form>
            </div>
        </div>
       
      </form>  
    
   </body>
   </html>    
   
<script>
var loadding_0 ;
$(function(){
    $("#btn").bind("click" , function(){
        
        var data_ = $("#info_form").serializeArray() ;
        $.ajax({
            type: "POST",
            url: "<?php echo  U("cache/index" , array('action'=>'update_cache' , 'inajax'=>1 ) ) ; ?>" ,
            data: data_,
            cache:false,
            dataType:"json",
            async:true,
            success: function(msg){
                var shtml = '' ;
                if(msg.resultcode != 1 ){
                    layer.msg(msg.resultinfo.errmsg);
                    return false ;
                }else{
                	$.layer({dialog: {type: 10,msg: msg.resultinfo.errmsg}});
                }
                layer.close(loadding_0);
            },
            beforeSend:function(){
                 loadding_0 = layer.load('正在更新缓存请耐心等待。。。。。。'); 
            },
            error:function(){
                layer.msg('服务器繁忙请稍后');
                return false ;
            }
            });
        
    });
    $("#all").click(function(){
    	   var obj = $("input[name='cache[]']");
    	   if(document.getElementById("all").checked == false)
    	   {
    	   for(var i=0; i<obj.length; i++)
    	   {
    	     obj[i].checked=false;
    	   }
    	   }else
    	   {
    	   for(var i=0; i<obj.length; i++)
    	   {  
    	     obj[i].checked=true;
    	   }
    	   }
		
	});        
}) ; 
</script>
        
        